// pages/index/index.js
Page({
   /**
    * 页面的初始数据
    */
   data: {
      // 视图容器
      view: [{
         name: "view",
         url: "/pages/assembly/assembly1/assembly1"
      }, {
         name: "可滚动视图",
         url: "/pages/assembly/assembly1/assembly1"
      }, {
         name: "滑块视图容器",
         url: "/pages/assembly/assembly3/assembly3"
      }, {
         name: "画布",
         url: "/pages/assembly/assembly3/assembly3"
      }, {
         name: "可移动区域",
         url: ""
      }, {
         name: "两种原生组件覆盖",
         url: ""
      }],
      // 基础内容
      base: [{
         name: "min图标",
         url: "/pages/assembly/assembly5/assembly5"
      }, {
         name: "进度条",
         url: "/pages/assembly/assembly6/assembly6"
      }, {
         name: "text文本",
         url: "/pages/assembly/assembly7/assembly7"
      }, {
         name: "rich-text富文本",
         url: ""
      }],
      // 表单组件
      form: [{
         name: "滑动选择器",
         url: "/pages/assembly/assembly2/assembly2"
      }, {
         name: "开关选择器",
         url: "/pages/assembly/assembly4/assembly4"
      }],
      // 扫码相关
      scan: [{
         name: "普通连接码",
         url: "/pages/scan/scan1/scan1"
      }, {
         name: "获取小程序码-接口B",
         url: "/pages/scan/scan2/scan2"
      }]
   },


   /**
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {
      // 随机数设置颜色
      var getRandomColor = function () {
         return '#' + Math.floor(Math.random() * 16777215).toString(16);
      }
      var arr = ["form", "view", "base", "scan"]
      for (var i in arr) {
         for (var j in this.data[arr[i]]) {
            this.data[arr[i]][j].color = getRandomColor();
         }
         this.setData({
            [arr[i]]: this.data[arr[i]]
         })
      }
   },

   /**
    * 生命周期函数--监听页面初次渲染完成
    */
   onReady: function () {

   },

   /**
    * 生命周期函数--监听页面显示
    */
   onShow: function () {

   },

   /**
    * 生命周期函数--监听页面隐藏
    */
   onHide: function () {

   },

   /**
    * 生命周期函数--监听页面卸载
    */
   onUnload: function () {

   },

   /**
    * 页面相关事件处理函数--监听用户下拉动作
    */
   onPullDownRefresh: function () {

   },

   /**
    * 页面上拉触底事件的处理函数
    */
   onReachBottom: function () {

   },

   /**
    * 用户点击右上角分享
    */
   onShareAppMessage: function () {

   }
})